/*(*)：用户输入任意一个正整数，求其所有位上的数字和并输出
比如123，和为6,10000和为1。*/
package ZUOYE0420;

import java.util.Scanner;

public class 作业十 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("输入一个数：");
		int a = in.nextInt();
		int gewei = a % 10;
		int d = 1;
		int c1 = 0;
		while (true) {
			d = d * 10;
			int b = d * 10;
			int c = a / d % 10;
			c1 = c1 + c;
			if (a % b == a) {
				break;
			}
		}
		System.out.println(c1 + gewei);

	}

}
